/*
 * All rights Reserved, Designed By baowei
 *
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 */
package com.xyy.scaffolddao.mapper;

import com.xyy.scaffolddao.dataobject.UserDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author : jiazhuang
 * @since : 2023/6/7, Wed
 **/
@Mapper
public interface UserMapper {
    /**
     * 根据姓名查找
     *
     * @param name
     * @return
     */
    UserDO findUserByName(String name);

    /**
     * 根据id查找
     *
     * @param id
     * @return
     */
    @Select("SELECT * FROM user WHERE id = #{id}")
    UserDO findUserById(@Param("id") Long id);

    /**
     * 插入用户
     *
     * @param name
     */
    @Insert("INSERT INTO user (name) VALUES (#{name})")
    void insertUser(@Param("name") String name);
}
